<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //封装函数money;定义形参
      function money(a=0, b=0, c=0) {
        a = a - b - c 
        return `余额为${a}`
      }
      // 弹出输入框，收集用户信息
      let balance = +prompt('请输入银行卡余额') //银行卡最开始余额 balance
      let eat = +prompt('请输入食宿费') //食宿费 eat
      let life = +prompt('请输入生活费')// 生活费 life
      // 将函数返回值赋予变量zong
      let zong = money(balance,eat,life)  
      // 输出余额
      alert(`银行卡余额还剩${zong}元`)
    </script>
  </body>
</html>
